﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace BHair
{
    public partial class frmjsr : Form
    {
        public frmjsr()
        {
            InitializeComponent();
        }
        public delegate void Ad(string ss);
        public event Ad AddName;
        public int jsrid;

        public void RaiseEvent(string newname)
        {
            if (AddName != null)
            {
                AddName(newname);
            }
        }
        private void frmjsr_Load(object sender, EventArgs e)
        {
            string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
            SqlConnection conn = new SqlConnection(constr);
            //定义查询员工sql
            string ygsql = "SELECT [eid]as 编号,[ename] as 姓名 ,[ephone] as 电话 FROM [BHairDB].[dbo].[employee]";
            DataTable dt = new DataTable();
            try
            {
                conn.Open();
                SqlDataAdapter sda = new SqlDataAdapter(ygsql,conn);
                sda.Fill(dt);
                this.skinDataGridView1.DataSource = dt;
            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int id = Int32.Parse(this.skinDataGridView1.SelectedCells[0].Value.ToString());
            //Formrk rk = Application.OpenForms["formrk"] as Formrk;
           // rk.txtjsr.Text = "ssss";
            //MessageBox.Show("s"+id);
            chuanzhi.jsid = id;
            //RaiseEvent(textBox1.Text.Trim());
           this.Close();
        }

        private void frmjsr_FormClosed(object sender, FormClosedEventArgs e)
        {
            //Formrk rk = new Formrk();
            /*rk.jsr(id);
            rk.ShowDialog();
            * */
           // rk.Refresh();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
